#ifndef DYNAMICJSONUI_H
#define DYNAMICJSONUI_H

#include <QWidget>
#include <QVariant>

namespace dynamic_json_ui {

struct JsonUiElement;

class DynamicJsonUI : public QWidget
{
    Q_OBJECT

public:
    explicit DynamicJsonUI(QWidget *parent = nullptr);

    void loadFromJsonString(const QString &jsonStr);
    void loadFromJsonFile(const QString &filePath);

    void setPropertyValue(const QString &id, const QString &property,
                          const QVariant &value);

Q_SIGNALS:
    void callJsFunction(const QString &funcName);

private:
    JsonUiElement parseJson(const QString &jsonStr);
};

} // namespace dynamic_json_ui

#endif // DYNAMICJSONUI_H
